import { useHistory, Link } from 'umi';

import styles from './index.less';

export default function IndexPage() {
  const history = useHistory();
  const tset_demo = () => {
    history.push('./tset_demo');
  };
  const table = () => {
    history.push({
      pathname: '/table',
    });
  };
  const Hoc = () => {
    history.push('./Hoc');
  };
  const dva = () => {
    history.push('./dva');
  };
  const router = () => {
    history.push({
      pathname: '/router',
      state: { test: 'dashboard' },
      search: 'test=22222',
    });
  };
  const toDo = () => {
    history.push('./todo');
  };
  return (
    <div>
      <h1 className={styles.title}>Page index</h1>
      <div onClick={tset_demo} style={{ background: 'greenyellow' }}>
        tset_demo
      </div>
      <div style={{ background: 'red' }} onClick={table}>
        table
      </div>
      <div style={{ background: 'pink' }} onClick={Hoc}>
        Hoc
      </div>
      <div style={{ background: '#00ff00' }} onClick={router}>
        router
      </div>
      <div style={{ background: '#f4a460' }} onClick={dva}>
        dva
      </div>
      <div style={{ background: '#f84210' }} onClick={toDo}>
        todo
      </div>
      <Link to="/router?search=11111#hash=123">router</Link>
    </div>
  );
}
